package com.sakila.pojo;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import com.sakila.pojo.other.Name;

public class Actor implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2532130529798785128L;
	private Integer id;
	private Name name;
	private Date lastUpdate;
	private Set<Film> films = new HashSet<Film>();
	
	public Actor(){
		
	}

	public Actor(Integer id, Name name, Date lastUpdate) {
		super();
		this.id = id;
		this.name = name;
		this.lastUpdate = lastUpdate;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Name getName() {
		return name;
	}

	public void setName(Name name) {
		this.name = name;
	}

	public Date getLastUpdate() {
		return lastUpdate;
	}

	public void setLastUpdate(Date lastUpdate) {
		this.lastUpdate = lastUpdate;
	}

	public Set<Film> getFilms() {
		return films;
	}

	public void setFilms(Set<Film> films) {
		this.films = films;
	}
	
	public void addFilm(Film film){
		film.addActor(this);
		this.films.add(film);
	}
	
	public void removeFilm(Film film){
		film.removeActor(this);
		this.films.remove(film);
	} 
}
